package Day10;

import javax.management.relation.RelationNotFoundException;
import java.util.Scanner;

public class Girl {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        GirlFriends gf = new GirlFriends();
        while (true) {
            try {
                System.out.println("请输入女朋友的姓名（在3-10个字之间");
                String name = sc.nextLine();
                gf.setName(name);
                System.out.println("请输入胡女朋友的年龄");
                String str = sc.nextLine();
                int age = Integer.parseInt(str);
                gf.setAge(age);
                break;
            } catch (NumberFormatException e) {
                System.out.println("年龄的格式输入有误");
                continue;
            } catch(RuntimeException e){
                System.out.println("姓名或者年龄输入不合法");
                continue;
            }
        }
        System.out.println(gf.getAge() + gf.getName());

    }







}
